package com.draw.b;




import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.Toast;

public class DrawBActivity extends Activity implements OnTouchListener, OnClickListener {
    /** Called when the activity is first created. */
	
	
	private Button btn;
	
	DrawView draw;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        LinearLayout linearlayout = (LinearLayout) findViewById(R.id.LinearLayout);
        Button btn = (Button) findViewById(R.id.btn);
        
        
        
        Spinner colorBox = (Spinner) findViewById(R.id.ColorChose);
        ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.colors, android.R.layout.simple_spinner_item);
        colorBox.setAdapter(adapter);   
        draw = new DrawView(this);
        linearlayout.addView(draw); 
        btn.setOnClickListener(new Button.OnClickListener(){

			public void onClick(View v) {
								
				
				Spinner colorBox = (Spinner) findViewById(R.id.ColorChose);
				String color = colorBox.getSelectedItem().toString();
				draw.addBall(color);
				Toast toast = Toast.makeText(getApplicationContext(), "hello", Toast.LENGTH_SHORT);
				toast.show();
				
			}
        	
        });
          
      
    
    }



	public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub
		
		
		
		
		return false;
	}



	public void onClick(View arg0) {
		// TODO Auto-generated method stub
		
	}
}